import IDB from './idb'
import { log } from './uitils/log'

function create({ dbName, version = new Date().getTime(), tables = [] }) {
  const db = new IDB({
    dbName,
    version,
  })

  for (const tableItem of tables) {
    // tableItem<Object> @tableName,@option,@indexs
    db.addTable(tableItem)
  }
  
  return db.open()
}

export default create
